﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.cruxomatic.configuration;
using com.cruxomatic.controllers;
using com.cruxomatic.DTOs;
using com.cruxomatic.DTOs.Configuration;
using com.cruxomatic.views;

public partial class ForgotPassword : System.Web.UI.Page, IForgotPassword
{
    ForgotPasswordController _controller;

    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = CruxConfigurationManager.GetApplicationThemeName();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        _controller = new ForgotPasswordController(this);
        _controller.InitView(IsPostBack);
    }
    protected void btnContinue_Click(object sender, EventArgs e)
    {
        _controller.ResetPassword();
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        _controller.NavigateToLoginPage();
    }

    public string UserName
    {
        get
        {
            return txtUserName.Text;
        }
    }

    public List<SecurityQuestionInformation> SecurityQuestionList
    {
        set
        {
            ddlSecretQuestion.DataSource = value;
            ddlSecretQuestion.DataValueField = "ID";
            ddlSecretQuestion.DataTextField = "Question";
            ddlSecretQuestion.DataBind();
        }
    }

    public string Answer
    {
        get
        {
            return txtSecurityAns.Text;
        }
    }


    public int SelectedSecurityQuestionId
    {
        get
        {
            return int.Parse(ddlSecretQuestion.SelectedValue);
        }
    }


    public ErrorInformation ErrorDetails
    {
        get
        {
            return pnlError.ErrorInformation;
        }
        set
        {
            pnlError.ErrorInformation = value;
        }
    }


    public bool EnableMailSentMessage
    {
        set
        {
            lblMessage.Visible = value;
        }
    }
}